package com.util;

import java.io.IOException;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class MySqlSessionFactory {
	static String  resource="MyBatis_cf.xml";
	static SqlSessionFactory factory=null;
	
	public static SqlSession getSqlSession(){
		try {
			factory=new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader(resource));
			SqlSession sqlsession=factory.openSession();
			return sqlsession;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
